#include "ShaderChunk.h"
POCELAIN_NAMESPACE_BEGIN

#include "ShaderChunk/common.glsl.h"
#include "ShaderChunk/uv_pars_vertex.glsl.h"
#include "ShaderChunk/uv_vertex.glsl.h"
#include "ShaderChunk/uv_pars_fragment.glsl.h"

#include "ShaderChunk/displacementmap_pars_vertex.glsl.h"
#include "ShaderChunk/displacementmap_vertex.glsl.h"

#include "ShaderChunk/bumpmap_pars_fragment.glsl.h"

#include "ShaderChunk/normal_pars_vertex.glsl.h"
#include "ShaderChunk/normal_vertex.glsl.h"
#include "ShaderChunk/normal_pars_fragment.glsl.h"
#include "ShaderChunk/normal_vertex.glsl.h"
#include "ShaderChunk/beginnormal_vertex.glsl.h"
#include "ShaderChunk/defaultnormal_vertex.glsl.h"
#include "ShaderChunk/normal_fragment_begin.glsl.h"
#include "ShaderChunk/normal_fragment_maps.glsl.h"
#include "ShaderChunk/normalmap_pars_fragment.glsl.h"

#include "ShaderChunk/morphtarget_pars_vertex.glsl.h"
#include "ShaderChunk/morphnormal_vertex.glsl.h"
#include "ShaderChunk/morphtarget_vertex.glsl.h"

#include "ShaderChunk/skinning_pars_vertex.glsl.h"
#include "ShaderChunk/skinbase_vertex.glsl.h"
#include "ShaderChunk/skinnormal_vertex.glsl.h"
#include "ShaderChunk/skinning_vertex.glsl.h"

#include "ShaderChunk/logdepthbuf_pars_vertex.glsl.h"
#include "ShaderChunk/logdepthbuf_vertex.glsl.h"
#include "ShaderChunk/logdepthbuf_pars_fragment.glsl.h"
#include "ShaderChunk/logdepthbuf_fragment.glsl.h"

#include "ShaderChunk/clipping_planes_pars_vertex.glsl.h"
#include "ShaderChunk/clipping_planes_vertex.glsl.h"
#include "ShaderChunk/clipping_planes_pars_fragment.glsl.h"
#include "ShaderChunk/clipping_planes_fragment.glsl.h"

#include "ShaderChunk/begin_vertex.glsl.h"
#include "ShaderChunk/project_vertex.glsl.h"

#include "ShaderChunk/packing.glsl.h"

#include "ShaderLib/background.glsl.h"
#include "ShaderLib/backgroundCube.glsl.h"
#include "ShaderLib/cube.glsl.h"
#include "ShaderLib/depth.glsl.h"
#include "ShaderLib/distanceRGBA.glsl.h"
#include "ShaderLib/equirect.glsl.h"
#include "ShaderLib/linedashed.glsl.h"
#include "ShaderLib/meshbasic.glsl.h"
#include "ShaderLib/meshlambert.glsl.h"
#include "ShaderLib/meshmatcap.glsl.h"
#include "ShaderLib/meshnormal.glsl.h"
#include "ShaderLib/meshphong.glsl.h"
#include "ShaderLib/meshphysical.glsl.h"
#include "ShaderLib/meshtoon.glsl.h"
#include "ShaderLib/points.glsl.h"
#include "ShaderLib/shadow.glsl.h"
#include "ShaderLib/sprite.glsl.h"


#define SHADERCHUNK_INSERT(name) { #name , name }
#define SHADERCHUNK_INSERT2(name) \
    SHADERCHUNK_INSERT(name##_vertex), \
    SHADERCHUNK_INSERT(name##_fragment)

std::map<std::string,std::string> ShaderChunk::smChunk =
{
    //shaderchunk
    SHADERCHUNK_INSERT(common),
    SHADERCHUNK_INSERT(common),
    SHADERCHUNK_INSERT(uv_pars_vertex),
    SHADERCHUNK_INSERT(uv_vertex),
    SHADERCHUNK_INSERT(uv_pars_fragment),

    SHADERCHUNK_INSERT(displacementmap_pars_vertex),
    SHADERCHUNK_INSERT(displacementmap_vertex),

    SHADERCHUNK_INSERT(bumpmap_pars_fragment),

    SHADERCHUNK_INSERT(normal_pars_vertex),
    SHADERCHUNK_INSERT(normal_vertex),
    SHADERCHUNK_INSERT(normal_pars_fragment),
    SHADERCHUNK_INSERT(normal_vertex),
    SHADERCHUNK_INSERT(beginnormal_vertex),
    SHADERCHUNK_INSERT(defaultnormal_vertex),
    SHADERCHUNK_INSERT(normal_fragment_begin),
    SHADERCHUNK_INSERT(normal_fragment_maps),
    SHADERCHUNK_INSERT(normalmap_pars_fragment),

    SHADERCHUNK_INSERT(morphtarget_pars_vertex),
    SHADERCHUNK_INSERT(morphnormal_vertex),
    SHADERCHUNK_INSERT(morphtarget_vertex),

    SHADERCHUNK_INSERT(skinning_pars_vertex),
    SHADERCHUNK_INSERT(skinbase_vertex),
    SHADERCHUNK_INSERT(skinnormal_vertex),
    SHADERCHUNK_INSERT(skinning_vertex),

    SHADERCHUNK_INSERT(logdepthbuf_pars_vertex),
    SHADERCHUNK_INSERT(logdepthbuf_vertex),
    SHADERCHUNK_INSERT(logdepthbuf_pars_fragment),
    SHADERCHUNK_INSERT(logdepthbuf_fragment),

    SHADERCHUNK_INSERT(clipping_planes_pars_vertex),
    SHADERCHUNK_INSERT(clipping_planes_vertex),
    SHADERCHUNK_INSERT(clipping_planes_pars_fragment),
    SHADERCHUNK_INSERT(clipping_planes_fragment),

    SHADERCHUNK_INSERT(begin_vertex),
    SHADERCHUNK_INSERT(project_vertex),

    SHADERCHUNK_INSERT(packing),


    //shaderlib
    SHADERCHUNK_INSERT2(background),
    SHADERCHUNK_INSERT2(backgroundCube),
    SHADERCHUNK_INSERT2(cube),
    SHADERCHUNK_INSERT2(depth),
    SHADERCHUNK_INSERT2(distanceRGBA),
    SHADERCHUNK_INSERT2(equirect),
    SHADERCHUNK_INSERT2(linedashed),
    SHADERCHUNK_INSERT2(meshbasic),
    SHADERCHUNK_INSERT2(meshlambert),
    SHADERCHUNK_INSERT2(meshmatcap),
    SHADERCHUNK_INSERT2(meshnormal),
    SHADERCHUNK_INSERT2(meshphong),
    SHADERCHUNK_INSERT2(meshphysical),
    SHADERCHUNK_INSERT2(meshtoon),
    SHADERCHUNK_INSERT2(points),
    SHADERCHUNK_INSERT2(shadow),
    SHADERCHUNK_INSERT2(sprite),

};
std::string ShaderChunk::getShaderSource(const std::string &name)
{
    auto it = smChunk.find(name);
    if(it == smChunk.end())
    {
        return "";
    }
    return it->second;
}
POCELAIN_NAMESPACE_END
